
#include "hud.h"

Hud::Hud()
{
	_radar = new MRadar(590, 390, 200, 200);
	_healthbar = new HealthBar(100, 10, 570, 570, 20); 
	_weapons = new WeaponHud(20, 480, 80, 80, 10);
}

Hud::~Hud()
{
	delete _radar;
	delete _healthbar;
	delete _weapons;
}

void Hud::Render(vector<CEnemy*> enemies, CPlayer *player, CCamera *cam, float worldDistanceClose, float worldDistanceFar)
{
	int width = 800;
	int height = 600;
	glMatrixMode(GL_PROJECTION);
	glPushMatrix();
	glLoadIdentity();
	glOrtho(0.0, width, height, 0.0, -1.0, 10.0);
	glMatrixMode(GL_MODELVIEW);
	glPushMatrix();

	glLoadIdentity();
	glDisable(GL_CULL_FACE);
	glClear(GL_DEPTH_BUFFER_BIT);

	// Draw HUD
	_weapons->Render(player->getGun());
	_radar->Render(player, enemies, cam, worldDistanceClose, worldDistanceFar);
	_healthbar->Render(float(player->getHitPoints()));
	

	// For switching back to 3d
	glMatrixMode(GL_PROJECTION);
	glPopMatrix();
	glMatrixMode(GL_MODELVIEW);
}